<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    body{
      display: flex;
      justify-content: center;
      align-items: center;
      min-height: 100vh;
      perspective: 200px;
      
    }
    img:hover{transform: rotate3d(0,0,-1,180deg);}
  </style>
</head>
<body>
  <script>
    const img=new Image()
    img.style.cssText='transition:all 1s;'
    img.src='http://picsum.photos/200/200'
    document.body.appendChild(img)
  </script>
</body>
</html>